package edu.hawaii.duedates.libraries;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;

/**
 * Test UhManoaLibrary class.
 * 
 * @author Creighton Okada
 * @author Ka Hung Phillip
 */
public class TestUhManoaLibrary {
  private final String id1 = System.getenv("DUEDATES_TESTUSER1_ID");
  private final String id2 = System.getenv("DUEDATES_TESTUSER2_ID");
  private final String lastName1 = System.getenv("DUEDATES_TESTUSER1_LASTNAME");
  private final String lastName2 = System.getenv("DUEDATES_TESTUSER2_LASTNAME");

  /**
   * Test for no books.
   * 
   * @throws Exception If unable to login.
   */
  @Ignore
  //@Test
  public void testUhNoBooks() throws Exception {
    UhManoaLibrary uhInfo = new UhManoaLibrary();
    List<LibraryBook> books = uhInfo.getUhInfo(id1, lastName1);
    assertTrue("Testing getUhInfo with no books.", books.isEmpty());
  }

  /**
   * Test for have books.
   * 
   * @throws Exception If unable to login.
   */
  @Ignore
  //@Test
  public void testUhBooks() throws Exception {
    UhManoaLibrary uhInfo = new UhManoaLibrary();
    List<LibraryBook> books = uhInfo.getUhInfo(id2, lastName2);
    assertTrue("Testing getUhInfo with no books.", books.isEmpty());
  }

  /**
   * Test for fail login.
   * 
   * @throws Exception If unable to login.
   */
  @Test(expected = AssertionError.class)
  public void testIllegalLogin() throws Exception {
    UhManoaLibrary uhInfo = new UhManoaLibrary();
    uhInfo.loginToUhLibrary(" ", " ");
    fail("Invalid account login passed");

  }

}
